package com.blog.controller;

import com.blog.Utils.Result;
import com.blog.bean.dto.CourseVideoDTO;
import com.blog.service.CourseVideoService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;
import java.util.Map;

/**
 * @author 任浩
 * @version 1.0
 */

@RestController
@RequestMapping("/courseVideo")
public class CourseVideoController {

    @Autowired
    private CourseVideoService courseVideoService;

    /**
     * 新增视频
     * @param courseVideoDTO
     * @return
     */
    @PostMapping("/add")
    public Result add(@RequestBody CourseVideoDTO courseVideoDTO) {
        return courseVideoService.add(courseVideoDTO);
    }

    /**
     * 根据课程id获取课程视频列表
     * @param id
     * @return
     */
    @GetMapping("/getByCourseId")
    public Result<List<Map<String,Object>>> getByCourseId(Integer id) {
        return courseVideoService.getByCourseId(id);
    }


}
